
<div id="accountBalanceList" class="full relative">
    <h1 class="title-big-01"><?=$LANG["label"]["LISTOFACCOUNT"];?></h1>

    <div id="link" class="clear">
        <?php
        $func = new Functions();
        $roleOfUser = $_SESSION['agentLog']['Role'];
        if (count($arr) > 1) {
            if ($arr[1]['Parentrole1'] == 4) {
                ?>
                <a href="<?php echo LODE_SERVER; ?>/View/agent-management-taikhoan.php?tab=listofuserbalance&action=listofuserbalance&parentid=<?= $arr[1]['Parentid1'] ?>" data-role='<?= $arr[1]['Parentrole1'] ?>' data-playerid='<?= $arr[1]['Parentid1'] ?>'><?= $arr[1]['Parentname1'] ?></a>
                <?php
            } else if ($arr[1]['Parentrole1'] == 3) {
                if ($roleOfUser == 3) {
                    ?>
                    <a href="<?php echo LODE_SERVER; ?>/View/agent-management-taikhoan.php?tab=listofuserbalance&action=listofuserbalance&parentid=<?= $arr[1]['Parentid1'] ?>" data-role='<?= $arr[1]['Parentrole1'] ?>' data-playerid='<?= $arr[1]['Parentid1'] ?>'><?= $arr[1]['Parentname1'] ?></a>
                <?php } else { ?>
                    <a href="<?php echo LODE_SERVER; ?>/View/agent-management-taikhoan.php?tab=listofuserbalance&action=listofuserbalance&parentid=<?= $arr[1]['Parentid2'] ?>" data-role='<?= $arr[1]['Parentrole2'] ?>' data-playerid='<?= $arr[1]['Parentid2'] ?>'><?= $arr[1]['Parentname2'] ?></a>
                    <a href="<?php echo LODE_SERVER; ?>/View/agent-management-taikhoan.php?tab=listofuserbalance&action=listofuserbalance&parentid=<?= $arr[1]['Parentid1'] ?>" data-role='<?= $arr[1]['Parentrole1'] ?>' data-playerid='<?= $arr[1]['Parentid1'] ?>'><?= $arr[1]['Parentname1'] ?></a>
                <?php } ?>
                <?php
            } else if ($arr[1]['Parentrole1'] == 2) {
                if ($roleOfUser == 4) {
                    ?>  
                    <a href="<?php echo LODE_SERVER; ?>/View/agent-management-taikhoan.php?tab=listofuserbalance&action=listofuserbalance&parentid=<?= $arr[1]['Parentid3'] ?>" data-role='<?= $arr[1]['Parentrole3'] ?>' data-playerid='<?= $arr[1]['Parentid3'] ?>'><?= $arr[1]['Parentname3'] ?></a>
                    <a href="<?php echo LODE_SERVER; ?>/View/agent-management-taikhoan.php?tab=listofuserbalance&action=listofuserbalance&parentid=<?= $arr[1]['Parentid2'] ?>" data-role='<?= $arr[1]['Parentrole2'] ?>' data-playerid='<?= $arr[1]['Parentid2'] ?>'><?= $arr[1]['Parentname2'] ?></a>
                    <a href="<?php echo LODE_SERVER; ?>/View/agent-management-taikhoan.php?tab=listofuserbalance&action=listofuserbalance&parentid=<?= $arr[1]['Parentid1'] ?>" data-role='<?= $arr[1]['Parentrole1'] ?>' data-playerid='<?= $arr[1]['Parentid1'] ?>'><?= $arr[1]['Parentname1'] ?></a>
                <?php } else if ($roleOfUser == 3) { ?>
                    <a href="<?php echo LODE_SERVER; ?>/View/agent-management-taikhoan.php?tab=listofuserbalance&action=listofuserbalance&parentid=<?= $arr[1]['Parentid2'] ?>" data-role='<?= $arr[1]['Parentrole2'] ?>' data-playerid='<?= $arr[1]['Parentid2'] ?>'><?= $arr[1]['Parentname2'] ?></a>
                    <a href="<?php echo LODE_SERVER; ?>/View/agent-management-taikhoan.php?tab=listofuserbalance&action=listofuserbalance&parentid=<?= $arr[1]['Parentid1'] ?>" data-role='<?= $arr[1]['Parentrole1'] ?>' data-playerid='<?= $arr[1]['Parentid1'] ?>'><?= $arr[1]['Parentname1'] ?></a>
                <?php } else if ($roleOfUser == 2) { ?>
                    <a href="<?php echo LODE_SERVER; ?>/View/agent-management-taikhoan.php?tab=listofuserbalance&action=listofuserbalance&parentid=<?= $arr[1]['Parentid1'] ?>" data-role='<?= $arr[1]['Parentrole1'] ?>' data-playerid='<?= $arr[1]['Parentid1'] ?>'><?= $arr[1]['Parentname1'] ?></a>
                <?php } ?>
                <?php
            } else if ($arr[1]['Parentrole1'] == 1) {
                if ($roleOfUser == 4) {
                    ?>
                    <a href="<?php echo LODE_SERVER; ?>/View/agent-management-taikhoan.php?tab=listofuserbalance&action=listofuserbalance&parentid=<?= $arr[1]['Parentid4'] ?>" data-role='<?= $arr[1]['Parentrole4'] ?>' data-playerid='<?= $arr[1]['Parentid4'] ?>'><?= $arr[1]['Parentname4'] ?></a>
                    <a href="<?php echo LODE_SERVER; ?>/View/agent-management-taikhoan.php?tab=listofuserbalance&action=listofuserbalance&parentid=<?= $arr[1]['Parentid3'] ?>" data-role='<?= $arr[1]['Parentrole3'] ?>' data-playerid='<?= $arr[1]['Parentid3'] ?>'><?= $arr[1]['Parentname3'] ?></a>
                    <a href="<?php echo LODE_SERVER; ?>/View/agent-management-taikhoan.php?tab=listofuserbalance&action=listofuserbalance&parentid=<?= $arr[1]['Parentid2'] ?>" data-role='<?= $arr[1]['Parentrole2'] ?>' data-playerid='<?= $arr[1]['Parentid2'] ?>'><?= $arr[1]['Parentname2'] ?></a>
                    <a href="<?php echo LODE_SERVER; ?>/View/agent-management-taikhoan.php?tab=listofuserbalance&action=listofuserbalance&parentid=<?= $arr[1]['Parentid1'] ?>" data-role='<?= $arr[1]['Parentrole1'] ?>' data-playerid='<?= $arr[1]['Parentid1'] ?>'><?= $arr[1]['Parentname1'] ?></a>
                <?php } else if ($roleOfUser == 3) { ?>
                    <a href="<?php echo LODE_SERVER; ?>/View/agent-management-taikhoan.php?tab=listofuserbalance&action=listofuserbalance&parentid=<?= $arr[1]['Parentid3'] ?>" data-role='<?= $arr[1]['Parentrole3'] ?>' data-playerid='<?= $arr[1]['Parentid3'] ?>'><?= $arr[1]['Parentname3'] ?></a>
                    <a href="<?php echo LODE_SERVER; ?>/View/agent-management-taikhoan.php?tab=listofuserbalance&action=listofuserbalance&parentid=<?= $arr[1]['Parentid2'] ?>" data-role='<?= $arr[1]['Parentrole2'] ?>' data-playerid='<?= $arr[1]['Parentid2'] ?>'><?= $arr[1]['Parentname2'] ?></a>
                    <a href="<?php echo LODE_SERVER; ?>/View/agent-management-taikhoan.php?tab=listofuserbalance&action=listofuserbalance&parentid=<?= $arr[1]['Parentid1'] ?>" data-role='<?= $arr[1]['Parentrole1'] ?>' data-playerid='<?= $arr[1]['Parentid1'] ?>'><?= $arr[1]['Parentname1'] ?></a>
                <?php } else if ($roleOfUser == 2) { ?>
                    <a href="<?php echo LODE_SERVER; ?>/View/agent-management-taikhoan.php?tab=listofuserbalance&action=listofuserbalance&parentid=<?= $arr[1]['Parentid2'] ?>" data-role='<?= $arr[1]['Parentrole2'] ?>' data-playerid='<?= $arr[1]['Parentid2'] ?>'><?= $arr[1]['Parentname2'] ?></a>
                    <a href="<?php echo LODE_SERVER; ?>/View/agent-management-taikhoan.php?tab=listofuserbalance&action=listofuserbalance&parentid=<?= $arr[1]['Parentid1'] ?>" data-role='<?= $arr[1]['Parentrole1'] ?>' data-playerid='<?= $arr[1]['Parentid1'] ?>'><?= $arr[1]['Parentname1'] ?></a>
                <?php } else if ($roleOfUser == 1) { ?>
                    <a href="<?php echo LODE_SERVER; ?>/View/agent-management-taikhoan.php?tab=listofuserbalance&action=listofuserbalance&parentid=<?= $arr[1]['Parentid1'] ?>" data-role='<?= $arr[1]['Parentrole1'] ?>' data-playerid='<?= $arr[1]['Parentid1'] ?>'><?= $arr[1]['Parentname1'] ?></a>
                <?php } ?>
                <?php
            }
        } else {
            $haveChild = $func->checkHaveChild($_SESSION['agentLog']['PlayerID']);
            if ($haveChild['mems'] > 0) {
                ?>
                <input class="button-green-1" type="button" value="<?=$LANG["label"]["BACK"];?>" name="back" onclick="goBack();">
                <?php
            } else {
                
            }
        }
        ?>
    </div>

    <div class="table-management-1" id="itemContainer">
        <div class="row caption clear">
            <span class="no"><?=$LANG["label"]["NUMBER"];?></span>
            <span class="username"><?=$LANG["label"]["USER"];?></span>
            <span class="firstname"><?=$LANG["label"]["FIRSTNAME"];?></span>
            <span class="lastname"><?=$LANG["label"]["LASTNAME"];?></span>
            <span class="gender"><?=$LANG["label"]["GENDER"];?></span>
            <span class="balance"><?=$LANG["label"]["ACCOUNT"];?> (VNĐ)</span>
            <span class="member"><?=$LANG["label"]["MEMBER"];?></span>
            <span class="lastlogin"><?=$LANG["label"]["LASTLOGIN"];?></span>
        </div>

        <?php
        if (count($arr) > 1) {
            for ($i = 1; $i < count($arr); $i++) {
                ?>
                <div class="row clear">
                    <span title="" class="no"><?= $i ?></span>
                    <?php if ($arr[$i]['Role'] > 0) { ?>
                        <span title="" class="username"><a href="<?php echo LODE_SERVER; ?>/View/agent-management-taikhoan.php?tab=listofuserbalance&action=listofuserbalance&parentid=<?= $arr[$i]['PlayerID'] ?>" data-role='<?= $arr[$i]['Role'] ?>' data-parentid='<?= $arr[$i]['Parentid1'] ?>'  data-playerid='<?= $arr[$i]['PlayerID'] ?>'><?= $arr[$i]['Username'] ?></a></span>
                    <?php } else { ?>
                        <span title="" class="username"><?= $arr[$i]['Username'] ?></span>
                    <?php } ?>
                    <span title="" class="firstname"><?= $arr[$i]['FirstName'] ?></span>
                    <span title="" class="lastname"><?= $arr[$i]['LastName'] ?></span>
                    <span title="" class="gender"><?= ($arr[$i]['Gender'] == 1) ? $LANG["label"]["MALE"] : $LANG["label"]["FEMALE"] ?></span>
                    <span title="" class="balance"><?= number_format($arr[$i]['BMoney'], "0", ",", "."); ?></span>
                    <span title="" class="member"><?= $arr[$i]['mems'] ?></span>
                    <span title="" class="lastlogin"><?= ($arr[$i]['LastLogin'] == '0000-00-00 00:00:00') ? $LANG["label"]["NEVERLOGIN"] : $arr[$i]['LastLogin'] ?></span>
                </div>
                <?php
            }
            ?>

            <?php include_once '../View/templates/global/ct-paging.php'; ?>

            <?php
        } else {
            ?>
            <div class="row empty clear"><?=$LANG["label"]["NODATA"];?> !</div>
        <?php } ?>

    </div>
</div>